<template>
  <div style="padding: 30px;">
    <div class="box-card">
      <div style="font-weight: 700;font-size: 22px;margin: 20px 0;">
        详情
      </div>
      <div class="f-column-between">
        <div class="f-row">
          <div style="width: 40%;"> <span>用户id：{{details.userId}}</span></div>
          <div style="width: 40%;"><span>申请时间：{{details.createTime}}</span> </div>
        </div>
        <div style="margin-top: 20px;" class="f-row">
          <div style="width: 40%;"> <span>公司或机构名称：{{details.company}}</span></div>
          <div style="width: 40%;"><span>1年内资金流水：{{details.capitalFlowGroupId}}</span> </div>
        </div>
        <div style="margin-top: 20px;" class="f-row">
          <div style="width: 40%;"> <span>业务经营范围证明资料：{{details.busScopeGroupId}} </span></div>
          <div style="width: 40%;"><span>业务经营范围证明资料：{{details.busScope}} </span></div>
        </div>
        <div style="margin-top: 20px;" class="f-row">
          <div style="width: 40%;"> <span>银行资信证明id：{{details.bankCreditGroupId }} </span></div>
          <div style="width: 40%;" class="f-row-between"><span>银行资信证明：：{{details.bankCredit}} </span>
          </div>
        </div>
        <div style="margin-top: 20px;" class="f-row">
          <div style="width: 40%;white-space:nowrap;" class="f-row-Hcenter"> <span>审批描述： </span>
            <el-input v-if="details.status == 2 " v-model="ruleForm1.description" placeholder="请输入内容"></el-input><span>{{details.approvalDesc}}</span>
          </div>
          <div style="width: 40%;" class="f-row-between">
            <span>
              状态：
              {{details.status == 0 ?'不可用':''}}
              {{details.status == 1 ?'草稿':''}}
              {{details.status == 2 ?'审核中':''}}
              {{details.status == 3 ?'审批通过':''}}
              {{details.status == 4 ?'审批不通过':''}}
            </span>
            <div v-if="details.status == 2 ">
              <el-button type="success" plain @click="stepsBtn(0)">不通过</el-button>
              <el-button type="success" plain @click="stepsBtn(1)"> 通过</el-button>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="box-card" v-for="(item ,index) in consigneeIstoSims">
      <div style="font-weight: 700;font-size: 22px;margin: 20px 0;">
        地址{{index}}
      </div>
      <div class="f-column-between">
        <div class="f-row">
          <div style="width: 40%;"> <span>用户id：{{item.userId}}</span></div>
          <div style="width: 40%;"><span>数量：{{item.amount}}</span> </div>
        </div>
        <div style="margin-top: 20px;" class="f-row">
          <div style="width: 40%;"> <span>期数：{{details.curStage }} </span></div>
          <div style="width: 40%;" class="f-row-between"><span>币种：{{details.stCode}} </span> <span>编号：{{details.code}}
            </span>
          </div>
        </div>
      </div>
    </div>
  </div>
  </div>
</template>

<script>
  import serveApi from "@/api/serveApi"
  export default {
    data() {
      return {
        routeData: {},
        query1: {
          id: 0,
          applyIstoId: 0
        },
        details: {},
        ruleForm1: {
          applyConId: '', //integer($int64)
          approve: '', //string审批0不通过，1通过
          // approver: '', //string审批人
          description: '', // string审批描述
        }
      }
    },
    mounted() {
      this.userId = this.$store.state.userInfo.id;
      this.routeData = this.$route.query
      this.getDetails();
    },
    methods: {
      getDetails() {
        this.query1.id = this.routeData.id;
        serveApi.applyCon_detail(this.query1).then(res => {
          if (res.status == "0000") {
            if (res.data) {
              this.details = res.data;

              this.ruleForm1.applyConId = this.details.id;
            }
          } else {
            this.$message.error(res.message);
          }
        });
      },
      stepsBtn(e) {
        this.ruleForm1.approve = e;
        
        serveApi.applyConApv_approval(this.ruleForm1).then(res => {
          if (res.data) {
            this.$message.success('保存成功');
          } else {
            this.$message.error(res.message);
          }
        });
      }

    }
  }
</script>

<style>
  .box-card {
    padding: 25px;
    box-shadow: 0px 0px 10px 0px rgba(178, 178, 178, 0.2);
    border-radius: 4px;
    background-color: rgba(77, 231, 231, 1.0);
  }
</style>
